'use strict';

module.exports = app => {
  const { router, controller } = app;

  router.resources('csrf', '/api/csrf', controller.api.csrf);

  router.post('/api/user/login', controller.api.user.index.login);
  router.get('/api/user/session-login', controller.api.user.index.sessionLogin);
  router.get('/api/user/verification-code', controller.api.user.index.verificationCode);

  router.resources('banner', '/api/banner', controller.api.banner.crud);

  router.resources('home-link', '/api/home-link', controller.api.homelink.crud);

  router.resources('study-time-line', '/api/study-time-line', controller.api.studyTimeLine.crud);

  router.resources('feedback', '/api/feedback', controller.api.feedback.crud);

  router.resources('me', '/api/me', controller.api.me.crud);

  router.get('/api/product/me', controller.api.product.index.me);
  router.get('/api/product/types', controller.api.product.index.types);
  router.post('/api/product/comments/:id', controller.api.product.index.addComments);
  router.delete('/api/product/comments/:id', controller.api.product.index.deleteComments);
  router.resources('product', '/api/product', controller.api.product.crud);

  router.get('/api/study/me', controller.api.study.index.me);
  router.get('/api/study/types', controller.api.study.index.types);
  router.post('/api/study/comments/:id', controller.api.study.index.addComments);
  router.delete('/api/study/comments/:id', controller.api.study.index.deleteComments);
  router.resources('study', '/api/study', controller.api.study.crud);

  router.get('/api/package/types', controller.api.package.index.types);
  router.post('/api/package/comments/:id', controller.api.package.index.addComments);
  router.delete('/api/package/comments/:id', controller.api.package.index.deleteComments);
  router.resources('package', '/api/package', controller.api.package.crud);

  router.post('/api/server/image-up', controller.api.server.index.imageUp);

  router.post('/api/baidu/local-text-identify', controller.api.baidu.index.localTextIdentify);
  router.post('/api/baidu/url-text-identify', controller.api.baidu.index.urlTextIdentify);
  router.post('/api/baidu/qrocde-identify', controller.api.baidu.index.qrcodeIdentify);
  router.post('/api/baidu/idcard-identify', controller.api.baidu.index.idcardIdentify);
  router.post('/api/baidu/bankcard-identify', controller.api.baidu.index.bankcardIdentify);
  router.post('/api/baidu/other-identify', controller.api.baidu.index.otherIdentify);

  router.post('/api/coding/base64', controller.api.coding.index.base64);
  router.post('/api/coding/image-to-base64', controller.api.coding.index.imgToBase64);
  router.post('/api/coding/base64-to-image', controller.api.coding.index.base64ToImg);
  router.post('/api/coding/md5', controller.api.coding.index.md5);
  router.post('/api/coding/hmac', controller.api.coding.index.hmac);
  router.post('/api/coding/aes', controller.api.coding.index.aes);

  router.resources('cache-data', '/api/cache-data', controller.api.cacheData.crud);

  router.resources('api/siteNavigation', '/api/site-navigation', controller.api.siteNavigation.crud);

  // router.resources('logs/webProcess', '/api/logs/web-process', controller.api.logs.webProcess.crud);
  // router.resources('logs/webAjax', '/api/logs/web-ajax', controller.api.logs.webAjax.crud);
  // router.resources('logs/webError', '/api/logs/web-error', controller.api.logs.webError.crud);
  // router.resources('logs/serverProcess', '/api/logs/server-process', controller.api.logs.serverProcess.crud);
  // router.resources('logs/serverError', '/api/logs/server-error', controller.api.logs.serverError.crud);
};
